define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		function get_data_startsEdit(result) {
			if(false) {
				result = '{"success": true,"msg": "","result": {"id": "001"},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		}

		//根据id显示详情
		function get_data_vedio(result) {
            if(false) {
                result = '{"success":true,"msg":"","result":{"id":"001","title":"青春无限","video_url":"","company_profile":"五金专卖","image":{"id":1,"image":"img/upload/pro-img01.jpg"}},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
                return JSON.parse(result);
            } else {
                return result;
            }
        }

		//返回信息
		return {
			//发布修改企业宣传
			edit: function(id,title,url,images,company_profile,video_type,callback) {
			    var params=new Object();
			    params.id=id;
			    params.name=title;
			    params.url=url;
			    params.image=images;
			    params.company_profile=company_profile;
			    params.video_type=video_type;//类型(后来新增的)
			    params=JSON.stringify(params);
				Http.post({
					method: 'info.starenterprise.edit',
					updateParams:params

				}, function(result) {
					//函数回调
					if(callback)
					callback(get_data_startsEdit(result));

				}, function(e) {

				}, function() {

				});

			},
			get_vedio:function(id,callback){
			    Http.post({
			        method: 'info.starenterprise.editdetail',
                    id:id
			    }, function(result) {
                    //函数回调
                    if(callback)
                    callback(get_data_startsEdit(result).result);

                }, function(e) {

                }, function() {

                });
			}

		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Starbusiness_publicity_apply", factory);
});